package rmi;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

public class RMIServer extends UnicastRemoteObject implements RMIServerInterface {
	private static final long serialVersionUID = 2891879792178789008L;
	
	protected RMIServer() throws RemoteException {
		super();
	}

	public static void main(String[] args) {
		run();
	}
	
	public static boolean run() {
		try {
			LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
			Registry reg = LocateRegistry.getRegistry();
			reg.rebind("TableMaster", new RMIServerTableMaster());
			reg.rebind("Table", new RMIServerTable());
			reg.rebind("Philosoph", new RMIServerPhilosoph());
			return true;
		}
		catch (RemoteException ex) {
			return false;
//			System.out.println(ex.getMessage());
		}
	}

}
